import React from "react";

import { Button } from "@mui/material";
import icon from "@/assets/images/home/subject.png";
import "./subjectitems.less";
import { useNavigate } from "react-router-dom";

interface Props {
  data: IRecords;
}

export default function SubjectItem({ data }: Props) {
  const navigate = useNavigate();
  return (
    <div className="sub-item">
      <section>
        <img src={icon} alt="" />{" "}
      </section>
      <section className="mid">
        <h4>{data.title}</h4>
      </section>
      <section>
        <Button
          onClick={() => navigate(`/select/${data.actionCode}`)}
          variant="contained"
        >
          刷题
        </Button>
      </section>
    </div>
  );
}
